import { Define, EntityObjectFactory } from 'tiny-entity2';
import { StoreStockItem } from '../..';
const EntityObjectType = EntityObjectFactory.GetEntityObjectType(process.env.dataBaseType || 'mysql');
@Define.Table({ TableName: 'stockorder' })
export class StockOrder extends EntityObjectType<StockOrder> {
    @Define.PrimaryKey()
    id: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        NotAllowNULL: true,
        IsIndex: true
    })
    storeId: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        NotAllowNULL: true
    })
    orderNo: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        NotAllowNULL: true
    })
    type: string;

    @Define.Column({
        DataType: Define.DataType.BIGINT,
        NotAllowNULL: true
    })
    createTime: number;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        NotAllowNULL: true
    })
    operatorId: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        NotAllowNULL: true
    })
    operatorName: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR,
        NotAllowNULL: true
    })
    status: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR
    })
    note: string;

    @Define.Column({
        DataType: Define.DataType.BIGINT
    })
    version: number;

    @Define.Mapping({
        Mapping: 'StoreStockItem',
        MappingKey: 'stockOrderId'
    })
    storeStockItems: StoreStockItem[];
}

export const StockOrderStatus = {
    Closed: 'closed'
}

export const StockOrderType = {
    StockIn: 'stockIn',
    SoldOut: 'soldOut',
    RefundIn: 'refundIn',
    InventoryIn: 'inventoryIn',
    InventoryOut: 'inventoryOut',
    OtherIn: 'otherIn',
    OtherOut: 'otherOut'
}